Skip to content

docs: explain how to exclude bundler virtual modules from reports - #1008

Merged
jennifer-shehane merged 2 commits into
masterfrom
claude/stencil-docs-code-coverage-rsowh5
Nov 1, 2026
Merged

jennifer-shehane merged 2 commits into
masterfrom
claude/stencil-docs-code-coverage-rsowh5

Conversation

@jennifer-shehane

@jennifer-shehane jennifer-shehane commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Additional details

#400 asked for a Stencil example. The one concrete failure in the thread was cy.task('coverageReport') hitting ENOENT on @lazy-browser-entrypoint?app-data=conditional. That's a Rollup virtual module: it gets instrumented, but no file exists on disk for it. The plugin passes every coverage key to nyc report and doesn't filter by whether the file exists, so the problem still applies today. What has changed is how it shows up. With nyc 18, the report no longer crashes. Instead you get an "Unable to lookup source ... ENOENT" page for that entry, and the entry still counts toward the totals.

This PR adds a short Bundler virtual modules note under "Exclude files and folders" in the README, with a snippet:

{
  "nyc": {
    "exclude": ["**/@lazy-browser-entrypoint*"],
    "excludeAfterRemap": true
  }
}

A few decisions worth flagging for review:

  • No Stencil test app. It felt too niche to maintain in the CI matrix, and the fix is pure nyc configuration.
  • No new "External examples" entry. The repo linked in the thread (maxkarkowski/stencil-example) doesn't show up in GitHub search anymore, and I didn't find another Stencil example repo.
  • excludeAfterRemap: true is required, not optional. The plugin defaults it to false, and in that case exclude alone leaves the virtual module in the report.
  • The older-version ENOENT crash comes from the thread. I didn't reproduce it, so the README links to [Feature request] Example for stenciljs #400 rather than stating it as tested.

Steps to test

  1. In an empty folder, create .nyc_output/out.json with two entries: one real instrumented file, and a copy of it whose path is @lazy-browser-entrypoint?app-data=conditional.
  2. Run npx nyc report --reporter=lcov with {"excludeAfterRemap": false} in .nycrc. coverage/lcov.info lists both SF: entries, and coverage/lcov-report/root/ has an "Unable to lookup source" page.
  3. Replace .nycrc with the README snippet's options and rerun. Only the real file remains.
  4. Optional: put an invisible null character before the virtual module's name. Rollup often does this for virtual modules. The same glob still excludes it.

npm run build, npm test and npm run format:check pass locally. I couldn't run npm run check:markdown locally because my environment blocks outbound link checks, so CI will be the first to check the new stenciljs.com and #400 links.

How has the user experience changed?

No change. This is a README-only update, and the plugin behaves the same in a Cypress run.


Generated by Claude Code


Note

Low Risk
README-only change with no code or configuration defaults modified in the plugin.

Overview
Adds a Bundler virtual modules note in the README under file/folder exclusion, addressing #400.

It explains that instrumented Rollup/Stencil-style virtual paths (e.g. @lazy-browser-entrypoint?app-data=conditional) can appear in coverage with no on-disk source, producing Unable to lookup source … ENOENT pages while still affecting totals. The doc recommends excluding those module names via nyc.exclude and setting excludeAfterRemap: true, with a concrete JSON example and a reminder to apply the same pattern for any phantom keys in .nyc_output/out.json.

No runtime or plugin behavior changes—documentation only.

Reviewed by Cursor Bugbot for commit a767432. Bugbot is set up for automated code reviews on this repo. Configure here.

Bundlers such as Stencil's Rollup build emit virtual modules (for
example `@lazy-browser-entrypoint?app-data=conditional`) that get
instrumented but have no file on disk. `nyc report` then shows an
"Unable to lookup source ... ENOENT" entry for them (older versions
failed outright), and they count toward coverage totals. Document
excluding them with `exclude` plus `excludeAfterRemap: true`.

Refs #400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r2pcQxLFLM65TTNcVW
…irtual modules note

Refs #400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r2pcQxLFLM65TTNcVW
@jennifer-shehane
jennifer-shehane merged commit af8130d into master Nov 1, 2026
32 checks passed
@jennifer-shehane
jennifer-shehane deleted the claude/stencil-docs-code-coverage-rsowh5 branch November 1, 2026 22:42
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Example for stenciljs

2 participants